import { ModalProps } from 'antd';
import React from 'react';
import { Button } from 'xwd-ant';

interface UseSwapButtonsProps {
  swapButtons?: boolean;
  onOk?: ModalProps['onOk'];
  onCancel?: ModalProps['onCancel'];
  okText?: React.ReactNode;
  cancelText?: React.ReactNode;
}

export function useSwapButtons({
  swapButtons,
  onOk,
  onCancel,
  okText = '确定',
  cancelText = '关闭',
}: UseSwapButtonsProps) {
  const footer = swapButtons
    ? (
      <div style={{ display: 'flex', justifyContent: 'flex-end', gap: '8px' }}>
        <Button key="ok" type="primary" onClick={onOk}>
          {okText}
        </Button>
        <Button key="cancel" onClick={onCancel}>
          {cancelText}
        </Button>
      </div>
    )
    : undefined;

  return { footer };
}
